﻿CREATE TABLE [dbo].[email_Queue] (
    [EmailQueueId]  INT            IDENTITY (1, 1) NOT NULL,
    [Recipient]     NVARCHAR (MAX) NOT NULL,
    [BccRecipient]  NVARCHAR (MAX) NULL,
    [Subject]       NVARCHAR (256) NOT NULL,
    [Body]          NVARCHAR (MAX) NOT NULL,
    [IsHtml]        BIT            NOT NULL,
    [BeginSentDate] DATETIME       NOT NULL,
    [CreateDate]    DATETIME       NOT NULL,
    [RequestDate]   DATETIME       NULL,
    [SendDate]      DATETIME       NULL,
    [ErrorDate]     DATETIME       NULL,
    [ErrorCount]    INT            NOT NULL,
    [ErrorText]     NVARCHAR (MAX) NULL,
    CONSTRAINT [PK_email_Queue] PRIMARY KEY CLUSTERED ([EmailQueueId] ASC)
);


GO
CREATE NONCLUSTERED INDEX [IX_email_Queue_RequestDate]
    ON [dbo].[email_Queue]([RequestDate] ASC);

